# 如果你有python的scipy包和ploty包，那么可以借助ploty包帮助可视化三维图形。
# 以下脚本由AI完成
import scipy.io
import plotly.graph_objects as go
from plotly.offline import plot

data = scipy.io.loadmat('atomic_orbs.mat')
x = data['x'];
y = data['y'];
z = data['z'];
Psi = data['Psi'];

downsample_factor = 3 #降低精度以避免过大的数据

x = x[::downsample_factor, ::downsample_factor, ::downsample_factor]
y = y[::downsample_factor, ::downsample_factor, ::downsample_factor]
z = z[::downsample_factor, ::downsample_factor, ::downsample_factor]
Psi = Psi[::downsample_factor, ::downsample_factor, ::downsample_factor]

fig = go.Figure(data=go.Volume(
    x=x.flatten(),
    y=y.flatten(),
    z=z.flatten(),
    value=Psi.flatten(),
    opacity=0.1, # needs to be small to see through all surfaces
    surface_count=20, # needs to be a large number for good volume rendering
    ))
plot(fig)
#fig.write_image("plotly_figure.png")
